<template>
  <el-dialog v-bind="$attrs" v-model="visible"  @closed="close">
        <slot name="content">
        </slot>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="visible = false">取 消</el-button>
        <el-button type="primary" @click="submit">确 认</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script  setup>
import { ref } from 'vue';

const emit = defineEmits()

let visible = ref(false)

// 打开
const show = (data) => {
  visible.value = true;
}
// 提交
const submit = () => {
  emit('submit', '数据')
  // visible.value = false;
}
// 关闭
const close = () => {
  emit('close', '数据')
  visible.value = false;
};

defineExpose({
  show,
  close
})

</script>

<style lang='scss' scoped>
.dialog-content {
  // height: 500px;
  // overflow-y: scroll;
}
.dialog-footer{
  text-align: center;
}
</style>
